# def demo1():
#     num = int(input('输入一个整数'))
#     return num
# def demo2():
#     print(demo1())
# if __name__ == '__main__':
#     try:
#         demo2()
#     except Exception as e:
# #         print(f'输入错误类型{e}')
str_data = 'i am mike,i like python'

print(str_data)
try:
    pos = str_data.index(input('请输入要查找的内容'))
    print(pos)
except ValueError:
    print('被查找字符串不在字符串中')
except Exception as e:
    print(f'其他错误类型{e}')
else:
    print(f'打印的位置为{pos}')
finally:
    print('程序运行结束')
# def input_password():
#     pwd = input('请输入密码:')
#     if len(pwd) < 8:
#         ex = Exception('密码长度不足8位')
#         # 创建一个异常对象
#         raise ex
#     # 抛出异常对象
#     else:
#         return pwd
# if __name__ == '__main__':
#     print(input_password())


